#include<iostream>
#include<algorithm>
using namespace std;
int n, m;
const int N = 5010;
typedef struct
{
	int id;
	int sum;
}S;
S s[N];
int cmp(S a, S b)
{
	if (a.sum != b.sum) {
		return a.sum > b.sum;
	}
	else {
		return a.id < b.id;
	}
}
int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> s[i].id >> s[i].sum;
	}
	sort(s, s + n ,cmp);
	int ans1 = s[(int)((m-1) * 1.5)].sum;
	int count = 0;
	for (int i = 0; i < n; i++) {
		if (s[i].sum >= ans1) {
			count++;
		}
	}
	cout << ans1 << " " << count << endl;
	for (int i = 0; i < count; i++) {
		cout << s[i].id << " " << s[i].sum << endl;
	}
	return 0;
}